<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<import type="js" file="js.jquery" />
<import type="js" file="js.common" />
<import type="css" file="css.global" />
<import type="css" file="css.form" />
<style type="text/css">
.SmallStatic{
	background: none repeat scroll 0 0 #E0E0E0;border: 1px solid #C0BBB4;font-size: 9pt;padding: 1px 5px;
}
</style>
<script type="text/javascript">
function CheckForm()
{
 if(document.form1.dept_no.value=="")
 { alert("部门排序号不能为空！");
	 return (false);
 }
 if(document.form1.dept_name.value=="")
 { alert("部门名称不能为空！");
	 return (false);
 }
}

function del(id){
	if (confirm("真的要删除吗？")){
		location="__APP__/Dept/delete?dept_id="+id;
	}else{
		return false;
	}
}

function SelectUser(type){
	var url = '__APP__/Dept/user_select?type='+type; //转向网页的地址;
	var name;
    var iWidth='570'; //弹出窗口的宽度;  
    var iHeight='400'; //弹出窗口的高度;  
    var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;  
    var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;  
    window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');  
}
function assignment(content,type)  
{  
    if(type==1){
	   document.getElementById("dept_header").value = content;//赋值  
    }else if(type==2){
    	document.getElementById("dept_level_header").value = content;//赋值  
    }
}

function ClearUser(type){
   if(type==1){
	   document.getElementById("dept_header").value = '';//赋值  
   }else if(type==2){
	   document.getElementById("dept_level_header").value = '';//赋值  
   }
}
parent.frames['list'].refresh()
</script>
</head>
<body>
<div class="search"><b>修改部门</b></div>
<div id="form">
	<form name="form1" action="__APP__/Dept/update" method="post" onSubmit="return CheckForm();" >
	<table>
		<tr>
			<td class="titlename">部门名称：</td>
			<td><input type="text" name="dept_no" size="10" maxlength="3" value="{$data.dept_no}">&nbsp;3位数字，用于同一级次部门排序，不能重复   </td>
		</tr>
		<tr>
			<td class="titlename">部门名称：</td>
			<td><input type="text" name="dept_name" value="{$data.dept_name}"></td>
		</tr>
		<tr>
			<td class="titlename">上级部门：</td>
			<td>
			<select name="dept_level" class="BigSelect">
	           <option value="0">无</option>
			   <volist name="data_dept" id="vo" >
			   <option value="{$vo.id}" <if condition="$data['dept_level'] eq $vo['id']">selected</if>>{$vo.dept_name}</option>
			   </volist>
	        </select>
			</td>
		</tr>
		<tr>
			<td class="titlename">部门负责人：</td>
			<td><input type="text" id="dept_header" name="dept_header" value="{$data.dept_header}" readonly class="SmallStatic" />
	        <input type="button" value="添加" class="button" onclick="SelectUser('1')" >
			<input type="button" value="清空" class="button" onclick="ClearUser('1')" >
	        </td>
		</tr>
		<tr>
			<td class="titlename">上级负责人：</td>
			<td><input type="text" id="dept_level_header" name="dept_level_header" value="{$data.dept_level_header}" readonly class="SmallStatic" />
			<input type="button" value="添加" class="button" onclick="SelectUser('2')" >
			<input type="button" value="清空" class="button" onclick="ClearUser('2')" ></td>
		</tr>
		
		<tr>
			<td class="titlename"></td>
			<td>
				<input type="hidden" name="id" value="{$id}">
				<input type="submit" value="保存" class="submit">&nbsp;&nbsp;
				<input type="button" value="删除当前部门" class="button" onClick="del({$id})" title="删除当前部门">
			</td>
		</tr>
	</table>
	</form>
</div>
</body>
</html>